package cn.zlp.sys.service.impl;

import cn.zlp.basic.service.impl.BaseServiceImpl;
import cn.zlp.sys.domain.DictionaryDetail;
import cn.zlp.sys.mapper.DictionaryDetailMapper;
import cn.zlp.sys.service.IDictionaryDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 数据字典类型Service类,先继承公共的Service类,再实现接口
 */
@Service
public class DictionaryDetailServiceImpl extends BaseServiceImpl<DictionaryDetail> implements IDictionaryDetailService {

    @Autowired(required = false)
    private DictionaryDetailMapper dictionaryDetailMapper;

    @Override
    public void add(DictionaryDetail dictionaryDetail) {
        dictionaryDetail.setTypes_id(dictionaryDetail.getDictionaryType().getId());
        dictionaryDetailMapper.save(dictionaryDetail);
    }

    @Override
    public void update(DictionaryDetail dictionaryDetail) {
        dictionaryDetail.setTypes_id(dictionaryDetail.getDictionaryType().getId());
        dictionaryDetailMapper.update(dictionaryDetail);
    }

    @Override
    public List<DictionaryDetail> typeList(Long id) {
        return dictionaryDetailMapper.typeList(id);
    }
}
